
/** @file polyhedra.h
 *
 * Interface to polyhedra
 *
 */

/*
 *  Copyright (C) 2007 Stefan Weinzierl
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __SECTOR_DECOMPOSITION_POLYHEDRA_H__
#define __SECTOR_DECOMPOSITION_POLYHEDRA_H__

#include <vector>
#include <cstddef>
#include <iostream>

#include <ginac/ginac.h>

#include "integrand.h"

namespace sector_decomposition {

  /**
   *
   * The class polyhedra.
   *
   * This class is used by strategies B and C.
   *
   */
  class polyhedra
    {
      // ctors
    public:
      polyhedra();
      polyhedra(GiNaC::ex poly, const std::vector<size_t> & index, const integration_data & global_data);
      polyhedra(const polyhedra & p1, const polyhedra & p2); 

      // member functions
    public:
      size_t number_corners() const;

      polyhedra & keep_corners_only();
      polyhedra & factorize_single_variables();
      polyhedra & add_point(const std::vector<GiNaC::ex> & point);

      GiNaC::ex get_factorization_degree() const;
      GiNaC::ex get_factorization_degree(const multi_index_ordered & index_set) const;

      void get_omega(std::vector<GiNaC::ex> & omega) const;

      void find_S(std::vector<bool> & S, GiNaC::ex f_degree) const;

      polyhedra & projection(const std::vector<bool> & S, GiNaC::ex f, GiNaC::ex c);

      void find_minimal_subsector(std::vector<size_t> & index_set, GiNaC::ex f) const;

      // I/O operators
      friend std::ostream & operator<< (std::ostream & os, const polyhedra & arg);

      // member variables 
    public:
      /// a vector, serving as an index for the Feynman parameters
      std::vector<size_t> index;

      /// an array with the coordinates of the points of the polyhedron
      std::vector<std::vector<GiNaC::ex> > coordinates;
    };

} // namespace sector_decomposition

#endif // ndef __SECTOR_DECOMPOSITION_POLYHEDRA_H__

